home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-06-26 | 4.9 KB | 145 lines | [TEXT/GEOL] |
- Item 6335104 7-June-89 21:32
-
- From: D1716 Intelligent Sys Design,G Storm, PRT
-
- To: BURBECK.S Burbeck, Steve
-
- cc: MACAPP.TECH$ MACAPP Tech
-
- Sub: Fail 'QUIT' for app wk file
-
- Subject: Fail 'QUIT' for apps that use work files
-
- While working on a large multi-media knowledge base application, I
- discovered a problem in MacApp that only occcurs under very specific
- circumstances. The application I am developing handles extremely large
- amounts of information from a diverse set of media. For this reason, I have
- implemented the software in a manner similar to the DemoCards example. All
- changed information is written onto a work file which is then merged with the
- original data file when saved. The program uses the templates defined by the
- objects for storage and retrieval of all information on any of the files
- involved. These object templates are primarily defined as 'views' and also
- properly display the information to the user.
-
- The problem is that if the user chooses 'quit' and then responds with a
- 'yes' to a request to save the data, the views the save routines in the
- application uses to read and write the information are closed prior to the
- save. Normally I would have solved this type of problem by overriding the
- appropriate method and substituting code to make the system behave in the
- manner desired. In this case however I found that a very slight change to
- MacApp achieved the desired effect without causing problems with any of the
- software I have available to test the system. The major visible effect of the
- change I have made is that the save performed under the circumstances outlined
- above is performed prior to the windows on the screen being closed rather than
- after the windows are closed.
-
- When running optimized code the effects of this change are minimally
- evident to the user, but extremely critical to applications which may need the
- 'view' objects around a little while longer to complete the save. The details
- of the change I have instituted are limited to one method in 2.0b5
- (TApplication.Close) and are detailed below. The change requires moving two
- lines of code found in this method.
-
- Change FROM:
-
- PROCEDURE TApplication.Close;
- VAR
- wmgrWindow: WindowPtr;
-
- {-------------------------------+
- | FreeIt |
- +-------------------------------}
- PROCEDURE FreeIt(anEvtHandler: TEvtHandler);
- BEGIN
- anEvtHandler.Free; { ??? also call Terminate ??? }
- END;
-
- {-------------------------------+
- | CloseADocument |
- +-------------------------------}
- PROCEDURE CloseADocument (aDocument: TDocument);
-
- BEGIN
- aDocument.Close;
- END;
-
- BEGIN
- { Close all of the windows }
- REPEAT
- wmgrWindow := FrontWindow;
- IF wmgrWindow <> NIL THEN
- CloseWmgrWindow(wmgrWindow);
- UNTIL wmgrWindow = NIL;
-
- { Close any windowless documents }
- ForAllDocumentsDo(CloseADocument); {causes big problems here}
-
- gPrintHandler.Terminate;
- EachHandler(gHeadCoHandler, FreeIt);
- IF LoadScrap <> noErr THEN; { ??? }
- END;
-
-
- Change TO:
-
- PROCEDURE TApplication.Close;
- VAR
- wmgrWindow: WindowPtr;
-
- {-------------------------------+
- | FreeIt |
- +-------------------------------}
- PROCEDURE FreeIt(anEvtHandler: TEvtHandler);
- BEGIN
- anEvtHandler.Free; { ??? also call Terminate ??? }
- END;
-
- {-------------------------------+
- | CloseADocument |
- +-------------------------------}
- PROCEDURE CloseADocument (aDocument: TDocument);
-
- BEGIN
- aDocument.Close;
- END;
-
- BEGIN
- { Close any windowless documents }
- ForAllDocumentsDo(CloseADocument); {location seems better}
-
- { Close all of the windows }
- REPEAT
- wmgrWindow := FrontWindow;
- IF wmgrWindow <> NIL THEN
- CloseWmgrWindow(wmgrWindow);
- UNTIL wmgrWindow = NIL;
-
- gPrintHandler.Terminate;
- EachHandler(gHeadCoHandler, FreeIt);
- IF LoadScrap <> noErr THEN; { ??? }
- END;
-
- As I said earlier, I am generally reluctant to make any changes to MacApp
- directly when it is so easy to override methods that contain code that is
- undesireable to my particular needs. I feel, however, that this particular
- change is a reasonable modification to the system and is entirely necessary for
- larger applications that handle huge volumes of data using some form of work or
- scratch files for changes. I hope you will consider this recommendation, and
- inform me of your opinions regarding this overly long dissertation. Thanks for
- your time. Sincerely,
-
- Michael R. Staley
- Manager Software Development
-
- Intelligent Systems Design, Inc.
- NCR Center Suite 101
- 15400 S.E. 30th Place
- Bellevue, WA 98007-6546
-
- Direct: (512) 650 - 3917
- Phone: (206) 641-8012
- Fax: (206) 641-8233
- AppleLink: D1716
-
-
-